<template>
  <div id="app">
    <router-view/>
    <!-- 订单提醒 -->
    <orderNotice/>
  </div>
</template>

<script>
import { Loading } from 'element-ui';
import orderNotice from './components/orderNotice'
export default {
  name: 'App',
  computed:{
    loadingStatus(){
      return this.$store.state.main.loadingStatus
    }
  },  
  components:{
    orderNotice
  },
  watch:{
    loadingStatus(newVal,oldVal){
      // console.log(newVal,oldVal)
      if(newVal == true){
        var loading = Loading.service({
          fullscreen:true,
          text:'正在加载中...'
        })
      }else{
        // loading.close()
      }
    }
  },
  methods:{
    openFullScreen2() {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      setTimeout(() => {
        loading.close();
      }, 2000);
    }
  },
  // mounted(){
  //   if(this.$store.state.main.loadingStatus){
  //       var loading = Loading.service({
  //       fullscreen:true,
  //       text:'正在加载中...'
  //     })
  //   }else{
  //     console.log('555555555555')
  //     loading.close();
  //   }
  // }
}
</script>

<style>
#app {
  height: 100%;
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}
.padding-content{
  padding:20px 50px;
}
</style>
